Connecting to a Database

Once the JDBC Client is installed and the driver is configured the way you want it, you can connect from your application to your database in either of the following ways: with a connection URL through the JDBC Driver Manager or with a Java Naming Directory Interface (JNDI) data source.

For information about configuring JDBC client data sources and a list of JDBC connection attributes and their valid values, refer to the SequeLink Developer's Reference

Use the following steps to load the driver from your JDBC application.

1. Setting the Classpath

The JDBC Client must be defined in your CLASSPATH variable. The CLASSPATH is the search string your Java Virtual Machine (JVM) uses to locate the JDBC driver on your computer. If the driver is not defined on your CLASSPATH, you will receive a "class not found" error when trying to load the driver. Set your system CLASSPATH to include the following entries, where sljc.jar is the driver jar file and install_dir is the path to your JDBC Client installation directory:

install_dir/lib/sljc.jar 
install_dir/lib/slssl14.jar 
install_dir/lib/iaik_jce_full.jar 

Windows Example

CLASSPATH=.;c:\sljdbc60\driver\lib\sljc.jar 
CLASSPATH=.;c:\sljdbc60\driver\lib\slssl14.jar 
CLASSPATH=.;c:\sljdbc60\driver\lib\iaik_jce_full.jar 

UNIX Example

CLASSPATH=.:/home/user1/sljdbc60/driver/lib/sljc.jar 
CLASSPATH=.:/home/user1/sljdbc60/driver/lib/slssl14.jar 
CLASSPATH=
.:/home/user1/sljdbc60/driver/lib/iaik_jce_full.jar 

2. Registering the Driver

IMPORTANT: If using Java SE 6, you do not need to register the driver and can skip this step. Java SE 6 automatically registers the driver with the JDBC Driver Manager.

Registering the driver tells the JDBC Driver Manager which driver to load. The driver is registered by using the Class.forName method and specifying the driver class name as the argument. The name of the driver for the JDBC Client is com.ddtek.jdbc.sequelink.SequeLinkDriver.